package com.realtyManage.springboot.Service.impl;

import com.realtyManage.springboot.Dao.RoutePunchRepository;
import com.realtyManage.springboot.Model.Do.RoutePunch;
import com.realtyManage.springboot.Service.IRoutePunchService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import javax.transaction.Transactional;

/**
 * ShutDownServiceImpl
 *
 * @Author 杭州素色网络科技有限公司
 * @Date 2020/5/20
 **/
@Service
public class ShutDownServiceImpl implements ApplicationContextAware {

    private ApplicationContext context;

    public String shutDownContext() {
        ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) context;
        ctx.close();
        return "context is shutdown";
    }

    public String getIndex() {
        return "OK";
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context = applicationContext;
    }
}
